home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.1 / card_14666.txt < prev    next >
Text File  |  1989-02-26  |  7KB  |  170 lines

  1. -- card: 14666 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 14090
  5. -- name: PinPointer
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 00
  10. -- high flags: 0007
  11. -- rect: left=67 top=80 right=272 bottom=496
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: 
  20.  
  21.  
  22. -- part 2 (button)
  23. -- low flags: 00
  24. -- high flags: A003
  25. -- rect: left=339 top=281 right=303 bottom=426
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Pinpointer
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   if the optionkey is down then pass mouseup
  37.   put the number of card fields into theFields
  38.   put the number of card buttons into theButtons
  39.   put the lineSize into initialLineSize
  40.   put the centered into initialCentered
  41.   put the textAlign into initialTextAlign
  42.   put the filled into initialFilled
  43.   put the pattern into initialPattern
  44.   put the textFont into initialTextFont
  45.   put the textSize into initialTextSize
  46.   put the editBkgnd into initialEditBkgnd
  47.   set the lineSize to 1
  48.   set the centered to false
  49.   set the textAlign to center
  50.   set the pattern to 1
  51.   set the textFont to Monaco
  52.   set the textSize to 9
  53.   set the textStyle to plain
  54.   set the editBkgnd to true
  55.   repeat with thePass = 1 to 2
  56.     if thePass = 1 then set the filled to true
  57.     else set the filled to false
  58.     if theFields is not 0 then
  59.       repeat with thisField = 1 to theFields
  60.         if the visible of card field thisField = true then
  61.           choose rectangle tool
  62.           get the rectangle of card field thisField
  63.           put item one of it into topLeft
  64.           put "," & item two of it after topLeft
  65.           subtract 1 from item three of it
  66.           subtract 1 from item four of it
  67.           put item three of it into bottomRight
  68.           put "," & item four of it after bottomRight
  69.           drag from topLeft to bottomRight
  70.         end if
  71.       end repeat
  72.     end if
  73.     if theButtons is not 0 then
  74.       repeat with thisButton = 1 to theButtons
  75.         if the visible of card button thisButton = true then
  76.           get the rectangle of card button thisButton
  77.           put item one of it into topLeft
  78.           put "," & item two of it after topLeft
  79.           subtract 1 from item three of it
  80.           subtract 1 from item four of it
  81.           put item three of it into bottomRight
  82.           put "," & item four of it after bottomRight
  83.           if the style of card button thisButton = "roundRect" then
  84.             choose round rect tool
  85.           else choose rectangle tool
  86.           drag from topLeft to bottomRight
  87.         end if
  88.       end repeat
  89.     end if
  90.   end repeat
  91.   choose text tool
  92.   repeat with object = 1 to (theFields + theButtons)
  93.     if object ‚⧠theFields then
  94.       if the visible of card field object is true then
  95.         get the location of card field object
  96.         add 3 to item two of it
  97.         click at it
  98.         type "Field #" & object
  99.       end if
  100.     else
  101.       if the visible of card button (object - theFields) is true then
  102.         put the location of card button (object - theFields) into center
  103.         get the style of card button (object - theFields)
  104.         if it is not "roundRect" and it is not "checkBox" and it is not "radioButton" then
  105.           subtract 5 from item 2 of center
  106.           click at center
  107.           type "Button" & return & "#" & (object - theFields)
  108.         else
  109.           add 3 to item two of center
  110.           click at center
  111.           type "Button #" & (object - theFields)
  112.         end if
  113.       end if
  114.     end if
  115.   end repeat
  116.   set the editBkgnd to false
  117.   choose browse tool
  118.   set the editBkgnd to initialEditBkgnd
  119.   set the lineSize to initialLineSize
  120.   set the centered to initialCentered
  121.   set the textAlign to initialTextAlign
  122.   set the filled to initialFilled
  123.   set the pattern to initialPattern
  124.   set the textFont to initialTextFont
  125.   set the textSize to initialTextSize
  126. end mouseUp
  127.  
  128.  
  129.  
  130. -- part contents for background part 5
  131. ----- text -----
  132. 5
  133.  
  134. -- part contents for background part 12
  135. ----- text -----
  136. PinPointer
  137.  
  138. -- part contents for card part 1
  139. ----- text -----
  140. THIS BUTTON WILL PAINT OVER ANY ARTWORK CURRENTLY IN THE BACKGROUND OF THE STACK IN WHICH IT IS PLACED. PLEASE WORK ON A COPY OF THE STACK IN WHICH YOU THINK YOU MIGHT WANT TO USE THIS BUTTON!
  141.  
  142. From:    William G. Anderson, Jr.    76254,356
  143.  
  144. What does it do?
  145. If you have ever created buttons and fields in the card plane of a stack, and then gone to the background plane and wondered where all of those card objects were located (especially if you were painting something specific to a card object) then you may wish to use this button.  It gets the rectangle of each visible card object, then redraws the rectangle in the background plane. Each rectangle is then labeled as representing either a button or field, as well as showing the number of the object.
  146.  
  147. How it works:
  148. Once the button is pressed a filled white round rectangle is painted in the background plane for each visible round rectangle button, and a filled white rectangle is painted for each visible field and all other types of visible buttons. The choice of filled rectangles was made in case the background in which they are drawn contains artwork, in which case an unfilled figure would be obscured.
  149.  
  150. In a second pass, each rectangle is redrawn unfilled. This will show the edges of each object in case they overlap, which would obscure part of one of the filled objects drawn in the first pass.
  151.  
  152. Finally, each object is labeled either as "Field #" or 
  153. "Button #".
  154.  
  155. Because it is rather slow (if there are a large number of objects to draw), and the cursor cannot simply be set to the "watch" (it changes back to whatever drawing tool cursor is being used at the time), I chose not to lock the screen during the operation. At least then you can see what is happening. 
  156.  
  157. Limitations:
  158. While I tried to preserve any settings that could be changed during the operation of this button, I was unable to find a way to reset multiple font style settings. Therefore, at the completion of the script the font style is reset to "plain".
  159.  
  160. How to use this button:
  161. Simply copy the button labeled "Pinpointer" in the lower right corner of this card and paste it into the BACKGROUND of the card in which you would like to use it. It will work as well if pasted into the card layer, but will then also draw a representation of itself in the background layer.
  162.  
  163. (I know this may not please everyone, but if I made it not draw a representation of itself by having it check for the name "Pinpointer" someone would make a button with the same name and claim the script was flawed.)
  164.  
  165. Once you are finished with the button simply cut it from the card.
  166.  
  167. Snide remarks, whining, and lavish praise may be easyplexed to me:
  168.  
  169. William G. Anderson, Jr.    76254,356
  170.